const program=require('commander')

const {
  createProjectAction,
  addCpnAction,
  addPage,
  addStore
}=require('./actions')

const createCommands=()=>{
  program
  .command('create <project> [otherArgs...]')
  .description('clone a repository into a folder')
  .action(createProjectAction);

  program
  .command('addcpn <name>')
  .description('add vue component')
  .action(name=>{
    addCpnAction(name, program._optionValues.dest || 'src/components')
  })

  program
  .command('addpage <page>')
  .description('add vue page and router config')
  .action(page=>{
    addPage(page, program._optionValues.dest || `src/pages/${page.toLowerCase()}`)
  })

  program
  .command('addstore <store>')
  .description('add vue store')
  .action(store=>{
    addStore(store, program._optionValues.dest || `src/store/modules/${store.toLowerCase()}`)
  })
}

module.exports=createCommands